;(function (func) {
    if (typeof define === "function")
        define(function (require, exports, module) {
            return func();
        });
})(function () {
    'use strict';
    //获取模块
    var isNullObj = function(obj){
        for(var i in obj){
            if(obj.hasOwnProperty(i)){
                return false;
            }
        }
        return true;
    };
    var getModuler = function(hrefParams){
        var params = hrefParams.split("?");
        var moduler = params[0];
        return moduler;
    };
    //获取传递参数
    var getPageParams = function(hrefParams){
        var paramObj = {};//参数对象
        var params = hrefParams.split("?");
        if(params.length > 1){
            var paramstr = params[1];
            var paramArray = paramstr.split("&");
            for(var i = 0;i<paramArray.length;i++){
                var prop = paramArray[i].split("=");
                if(prop.length > 1){
                    paramObj[prop[0]] = prop[1];
                }
            }
        }
        return paramObj;
    };
    // 页面提示
    var success = function(txt){
        $("#mes-success").remove();
        var $mesCommon = $("<div>").addClass("mesCommon").attr("id","mes-success");
        var $mesCon = $("<p>").addClass("mesCon").html(txt);
        $mesCommon.append($mesCon);
        $("body").append($mesCommon);
        var ml = $mesCommon.width()/2;
        $mesCommon.css("margin-left","-"+ml+"px");
        setTimeout(function(){
            $mesCommon.remove();
        }, 1500);
    };
    var error = function(txt){
        $("#mes-error").remove();
        var $mesCommon = $("<div>").addClass("mesCommon").attr("id","mes-error");
        var $mesCon = $("<p>").addClass("mesCon").html(txt);
        $mesCommon.append($mesCon);
        $("body").append($mesCommon);
        var ml = $mesCommon.width()/2;
        $mesCommon.css("margin-left","-"+ml+"px");
        setTimeout(function(){
            $mesCommon.remove();
        }, 1500);
    };
    var alert = function(txt){
        $("#mes-alert").remove();
        var $mesCommon = $("<div>").addClass("mesCommon").attr("id","mes-alert");
        var $mesCon = $("<p>").addClass("mesCon").html(txt);
        $mesCommon.append($mesCon);
        $("body").append($mesCommon);
        var ml = $mesCommon.width()/2;
        $mesCommon.css("margin-left","-"+ml+"px");
        setTimeout(function(){
            $mesCommon.remove();
        }, 1500);
    };


     var parseDateStr = function(str){
        var dt  = new Date();
        dt.setTime = 0 ; 
        var numbers =  str.match(/\d+/g);
        var k ;
        for ( k in numbers){
            var v = parseInt(numbers[k],10);
            var idx = parseInt(k);
            switch(idx){
                case 0:
                    dt.setFullYear(v);
                    break;
                case 1:
                    dt.setMonth(v-1);
                    break; 
                case 2:
                    dt.setDate(v);
                    break; 
                case 3:
                    dt.setHours(v);
                    break; 
                case 4:
                    dt.setMinutes(v);
                    break;
                case 5:
                    dt.setSeconds(v);
                    break; 

            }

        }
        return dt ; 
    }



    return {
        isNullObj:isNullObj,
        getModuler:getModuler,
        getPageParams:getPageParams,
        success:success,
        error:error,
        alert:alert,
        parseDateStr:parseDateStr
    }
    
});